package com.springboot.exceptions;


import com.springboot.enums.CodeEnum;

/**
 * @author coDing
 */
@SuppressWarnings("unused")
public class ErrorCodeException extends RuntimeException {

    private static final long serialVersionUID = -7638041501183925225L;

    private Integer code;

    public ErrorCodeException(CodeEnum errorCode, String msg) {
        super(msg);
        this.code = errorCode.getCode();
    }

    public ErrorCodeException(Integer code, String msg) {
        super(msg);
        this.code = code;
    }

    public ErrorCodeException(CodeEnum errorCode) {
        super(errorCode.getMessage());
        this.code = errorCode.getCode();
    }

    public ErrorCodeException(String msg) {
        super(msg);
        this.code = CodeEnum.ERROR.getCode();
    }

    public Integer getCode() {
        return code;
    }

    public void setCode(Integer code) {
        this.code = code;
    }

}
